package com.dlc.shop.systemtest.api.amount;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dlc.shop.common.util.Json;
import com.dlc.shop.live.common.model.LiveRoom;
import com.dlc.shop.systemtest.constants.Constant;
import com.dlc.shop.systemtest.util.HttpUtil;

import java.util.List;

/**
 * @author lpj
 */
public class LiveApi {

//    /**
//     * 新增直播商品
//     */
//    public static void saveLiveProdStore(LiveProdStore liveProdStore) {
//        String url = Constant.SHOP_URL + "/live/liveProdStore";
//        HttpUtil.post(url, liveProdStore);
//    }
//
//    /**
//     * 分页查询直播间商品
//     */
//    public static List<LiveProdStore> getLiveProdStorePage() {
//        String url = Constant.SHOP_URL + "/live/liveProdStore/page";
//        return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), LiveProdStore.class);
//    }
//
//    /**
//     * 根据ID获取直播商品信息
//     */
//    public static LiveProdStore getLiveProdInfo(Long liveProdStoreId) {
//        String url = Constant.SHOP_URL + "/live/liveProdStore/info/" + liveProdStoreId;
//        return HttpUtil.get(url, LiveProdStore.class);
//    }
//
//    /**
//     *修改直播商品
//     */
//    public static void updateLiveProdStore(LiveProdStore liveProdStore) {
//        String url = Constant.SHOP_URL + "/live/liveProdStore";
//        HttpUtil.put(url, liveProdStore);
//    }
//
//    /**
//     * 直播商品提交审核
//     */
//    public static void submitVerify(LiveProdStore liveProdStore) {
//        String url = Constant.SHOP_URL + "/live/liveProdStore/submitVerify";
//        HttpUtil.put(url, liveProdStore);
//    }

    /**
     * 根据ID删除直播商品
     */
    public static void deleteLiveProdStore(Long liveProdStoreId) {
        String url = Constant.SHOP_URL + "/live/liveProdStore/" + liveProdStoreId;
        HttpUtil.delete(url);
    }


    /**
     * 新增直播间
     */
    public static void saveLiveRoom(LiveRoom liveRoom) {
        String url = Constant.SHOP_URL + "/multishop/live/liveRoom";
        System.out.println(liveRoom);
        HttpUtil.post(url, liveRoom);
    }

    /**
     * 分页获取直播间
     */
    public static List<LiveRoom> getLiveRoomPage() {
        String url = Constant.SHOP_URL + "/multishop/live/liveRoom/page";
        return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), LiveRoom.class);
    }

    /**
     * 根据ID获取直播间信息
     */
    public static LiveRoom getLiveRoomInfo(Long liveRoomId) {
        String url = Constant.SHOP_URL + "/multishop/live/liveRoom/info/" + liveRoomId;
        return HttpUtil.get(url, LiveRoom.class);
    }

    /**
     * 删除直播间
     */
    public static void deleteLiveRoom(Long liveRoomId) {
        String url = Constant.SHOP_URL + "/multishop/live/liveRoom/" + liveRoomId;
        HttpUtil.delete(url);
    }

    /**
     * 直播间添加直播商品
     */
    public static void addLiveRoomProd(LiveRoom liveRoom) {
        String url = Constant.SHOP_URL + "/multishop/live/liveRoom/addLiveRoomProd";
        HttpUtil.post(url,liveRoom);
    }

//    /**
//     * 平台分页获取直播成员
//     */
//    public static List<LiveUser> getLiveUserPage() {
//        String url = Constant.PLATFORM_URL + "/platform/live/liveUser/page";
//        return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), LiveUser.class);
//    }

}
